﻿@using Microsoft.Extensions.Primitives
@model AuthorizeViewModel
<style>
    .displayNone {
        display:none
    }
</style>
<div class="jumbotron">
    <h1>SBlogCore统一授权</h1>

    <p class="lead text-left"><strong>@Model.ApplicationName</strong>希望获取你的 (数据范围: @Model.Scope)</p>

    <form asp-controller="Authorization" asp-action="Authorize" method="post">
        <div>
            @foreach (var parameter in Context.Request.HasFormContentType ?(IEnumerable<KeyValuePair<string, StringValues>>) Context.Request.Form : Context.Request.Query)
            {
            <input type="hidden" name="@parameter.Key" value="@parameter.Value" />
                @*@parameter.Key <input  name="@parameter.Key" value="@parameter.Value" />*@
            }
        </div>
        <div>
            <div class="card" style="width: 18rem;">
                <div class="card-header">
                    授权范围
                </div>
                <ul class="list-group list-group-flush">
                    @foreach (var scope in Model.Scopes)
                    {
                        <li class="list-group-item">
                            <div class="form-check">
                                
                                @if (scope.disabled)
                                {
                                    <input class="form-check-input displayNone" type="checkbox" name="selectScope" value="@scope.name" onclick="return false" checked="@scope.check">
                                   @* <span>√</span>*@
                                                                                                                                                                                    
                                }
                                else
                                {
                                    <input class="form-check-input" type="checkbox" name="selectScope" value="@scope.name"  checked="@scope.check">
                                }
                                <label class="form-check-label">@scope.name</label>
                            </div>
                        </li>
                    }
                </ul>
            </div>
        </div>
        <div>
            <div class="form-check">
                <input class="form-check-input" type="checkbox" name="AuthorizePermanent" value="true">
                <label class="form-check-label">永久授权</label>
            </div>
        </div>
        <div>
            <input class="btn btn-lg btn-success" name="submit.Accept" type="submit" value="授权" />
            <input class="btn btn-lg btn-danger" name="submit.Deny" type="submit" value="拒绝" />
        </div>
    </form>
    
</div>
